// import { get , post} from "@/utils/request";
import request from "@/utils/request";
// 接口返回结构固定
// data 的类型, 传进来
type Result<T =undefined> ={
    code:string,
    message: string,
    data:T
}
type Tel = string
// export function login(loginname: string, password: string) {
//     return request.post<
//       any,
//       Result<{ token: string, userid: string}>
//       >('/user/login', {
//       loginname,
//       password
//     })
//   }

// 验证账号是否被注册
export function  IsRegistration(tel:Tel){
    return request.post<any,Result>('/user/docheckphone',{
        tel
    })
}

// 发送验证码
export function SendVerification(tel: Tel) {
    return request.post<any,Result<number>>('/user/dosendmsgcode', {
        tel
    })
}
// 验证验证码
export function yzmYz(tel:Tel,telcode:String |number){
    return request.post<any,Result>('/user/docheckcode',{
        tel,
        telcode
    })
}

// 注册
export function register(tel:Tel , password:string){
    return request.post<any,Result>('/user/dofinishregister',{
        tel,
        password
    })
}


// 登录
export function loginname(loginname:Tel,password:string){
    return request.post<any,Result<{token: string , userid:string}>>('/user/login',{
        loginname,
        password
    })
}